from djcontrol import *
from Tkinter import *
import djcontrolutil

from djcontrolutil import H,V

class DjFrame(DjControl):
	"""
	Frame widget. Does not really add value to the Tkinter frame, but exists for consistency.
	
	Properties:
	
	*bgcolor* - Background color of the label. RGB triplet, such as (255,0,0) for pure red.
	*borderwidth* - An integer, width of border in pixels.
	*borderstyle* - Border style. One of 'sunken','raised','groove','ridge','flat'. Default is 'sunken'.
	*width* - Set width. If set to 0, width is based on contents (the default behavior).
	*height* - Set height. If set to 0, width is based on contents (the default behavior).
	"""
	
	# Note that only names beginning with '_', or the special case basecontrol, should be used.
	_autoProperties = None
	_packOrientation = H
	basecontrol = 0
	
	def __init__(self, parent, orientation='H',label_frame_text=None,**options):
		parent = djcontrolutil.getbasecontrol(parent)
		if label_frame_text:
			self.basecontrol = LabelFrame(parent, text=label_frame_text)
		else:
			self.basecontrol = Frame(parent)
		
		self._packOrientation = orientation
		
		self._autoProperties = { 
		# Property name,  Tkinter property name, SET wrapper, GET wrapper
		'bgcolor': ('background',djcontrolutil.colorToString,djcontrolutil.stringToColor),
		'width': ('width',None,None),
		'height': ('height',None,None),
		'borderwidth': ('borderwidth',None,None),
		'borderstyle': ('relief', djcontrolutil.stringToRelief,djcontrolutil.reliefToString),
		}
		self.set_many(**options)
	
	
	
		
	_customProperties = ()
	def _lookupCustomProperties(self, bSet, strAttribute, value=None):
		pass
		
